package com.hiq.gogo;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

public class Schedule {

	private List<ScheduleItem> items = new ArrayList<ScheduleItem>();

	public void addItem(ScheduleItem item){
		this.items.add(item);
	};

	public String getMessage(Date date){
		Calendar c = Calendar.getInstance();
		c.setTime(date);
		int h = c.get(Calendar.HOUR_OF_DAY);
		int m = c.get(Calendar.MINUTE);
		for (ScheduleItem item : items) {
			if (item.isItTime(h, m)) {
				return item.getMsg();
			}
		}
		return null;
	}
}
